﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Text;
namespace IHISCETeim.Web.MachineSys.JSDWF
{
    public partial class JSDWFFolderList : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看, Permission.修改, Permission.新增, Permission.删除 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "JSDWFFolderList";
            }


        }

        protected void Page_Load(object sender, EventArgs e)
        {
           // Response.Write(GetFolderTree(0));
        }

        protected string GetFolderTree(int ParFolderID)
        {
            List<JSDWFFolderInfo> list = JSDWFFolderController.GetAllByParFolderId(ParFolderID);
            if (list.Count<=0)
                return "";

            /// <ul><li><a href="JSDWF/JSDWFFolderPageList.aspx?ParFolderID=1" target="ajax" rel="jbsxBox">尿检</a></li></ul>
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul>");
            foreach (JSDWFFolderInfo itm in list)
            {
                sb.Append("<li>");
                sb.AppendFormat("<a href=\"JSDWF/JSDWFFolderPageList.aspx?ParFolderID={0}\" target=\"ajax\" rel=\"jbsxBox\">{1}</a>",itm.FolderID,itm.FolderName);

                sb.Append(GetFolderTree(itm.FolderID));
                
                sb.Append("</li>");
            } 
            sb.Append("</ul>");

            return sb.ToString();
        }
    }
}